{extend name="default/template/base_index" /}

{block name="area_header"}
	<link rel="stylesheet" type="text/css" href="__CDN__/comp/wxuploader.css" />
	<link type="text/css" rel="stylesheet" href="__CDN__/jquery-uploadify/3.2.1/uploadify.css" />
	<script type="text/javascript" src="__CDN__/jquery-uploadify/3.2.1/jquery.uploadify.min.js"></script>
	<style type="text/css">
		.banner.wxuploaderimg {width: 320px;height: 100px;}
		.banner.wxuploaderimg .img-preview img{width: 320px;}
	</style>
{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
			
			<!-- 带验证 form -->
			<form class="form-horizontal well validateForm">
				<input type="hidden" name="id" value="{$vo.id}" />
				<fieldset>
					<legend>{$vo['position']}/{$vo['id']}	- Banners修改
					</legend>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图片标题<br/>(可选)</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" class="required form-control input-short" value="{$vo.title}" name="title" id="title" placeholder="图片标识,以示区别">
							<div class="help-block">(图片标识,以示区别)</div>
						</div>
					</div>
					<input type="hidden" name="position" value="{$vo['position']}">
					<!-- <div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">所在类别或位置</label>
						<div class="col-md-10 col-lg-10">
              <select name="position" class="form-control  input-normal" >
                :w_datatree(getDatatree('BANNERS_TYPE'),true,$vo['position']))
              </select>
							<div class="help-block">(选择类别或位置)</div>
						</div>
					</div> -->
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图片地址</label>
						<div class="col-md-10 col-lg-10">
							<input type="hidden" class="" name="img" id="img" placeholder="图片地址">
							<!-- 图片选择DOM结构 -->
							<div class="wxuploaderimg clearfix banner {notempty name="vo.img"}checked{/notempty}" data-maxitems="1">
								<div class="img-preview clearfix" >
									{notempty name="vo.img"}
									<div class="pull-left clearfix img-item">
										<img height="100" src="{:getImgUrl($vo['img'])}" {notempty name="vo.img"}data-imageid="{$vo.img}"{/notempty}/>
										<div class="edit_pic_wrp"><a href="javascript:;" class="fa fa-lg fa-trash js_delete"></a></div>
									</div>
									{/notempty}
								</div>
								<div class="add">
									<i class="fa fa-plus"></i>
								</div>
							</div>
							<!-- 图片选择DOM结构 -->
							<div class="help-block">(上传图片,尺寸：640像素*200像素)</div>
						</div>
					</div>
          <div class="form-group">
              <label for="inputtitle" class="col-md-2 col-lg-2 control-label">链接类型</label>
              <div class="col-md-10 col-lg-10">
							<select name="url_type" class="form-control  input-normal" >

								{:w_datatree(getDatatree('BANNERS_URL_TYPE'),true,$checkedID)}
							</select>
              </div>
          </div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">跳转链接<br/>(可选)</label>
						<div class="col-md-10 col-lg-10">
							<input name="url" class="form-control  input-normal" type="text" value="{$vo.url}" />
							<div class="help-block">(点击图片跳转链接，完整的链接地址)</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputtitle" class="col-md-2 col-lg-2 control-label">图片描述<br/>(可选)</label>
						<div class="col-md-10 col-lg-10">
							<input type="text" name="notes" value="{$vo.notes}" class="form-control  input-normal" />
							<div class="help-block">(图片描述:attr,40字以内)</div>
						</div>
					</div>

					<div class="form-group">
					    <label for="sort" class="col-md-2 col-lg-2 control-label">排序<br/>(可选)</label>
					    <div class="col-md-10 col-lg-10">
					        <input name="sort" class="form-control  input-short" type="text" value="{$vo.sort}" />
					        <div class="help-block">(图片排序序号)</div>
					    </div>
					</div>

					<div class="form-group">
						<label class="col-md-2 col-lg-2 control-label">&nbsp;</label>
						<div class="col-lg-10 col-md-10">
							<a target-form="validateForm" onclick="getData();" class="ajax-post btn btn-primary" href="{:url('Banners/edit')}" autofocus="autofocus"><i class="fa fa-save"></i>保存</a>
							<a class="btn btn-default" href="{:url('Banners/index')}">
								<i class="fa fa-reply"></i>								返回</a>
						</div>
					</div>
				</fieldset>
			</form>
			<!-- form -->
			{include file="default/template/wxpicture" /}
		</div>
		<!-- END admin-main-content -->
	</div>
	<!-- END admin-main-->
{/block}

{block name="area_footer"}
	<script type="text/javascript">
	function getData(){
		var img = $(".wxuploaderimg img").attr("data-imageid");
		$("#img").val(img);
	}
	
	$(function(){
			wxuploadimg.init({cont:".wxuploaderimg"});
	});
	</script>
{/block}